package ua.at.javac.cron;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; 
import java.net.URL; 

/**
 * Читает url
 * 
 * @author Michael.Michaelovich
 * @version 103
 * @since 2012
 */
public class Reader {
	
	public StringBuffer readUrl() throws IOException{
		try{
			is = url.openConnection().getInputStream();
			reader = new BufferedReader( 
					new InputStreamReader(is,"UTF-8"));
			sbuff = new StringBuffer();
			while ((line = reader.readLine())!=null) {
				sbuff.append(line);
			}
		}
		catch(Exception e){
			e.printStackTrace();
		}
		finally{
			is.close();
		}
		return sbuff;
	}
	
	public Reader(String surl) throws IOException{
		this.url = new URL(surl);
	}
	
	private BufferedReader reader;
	private URL url;
	private InputStream is ;
	private static StringBuffer sbuff;
	private String line;   
}

